#!/usr/bin/env python
# -*- coding: utf-8 -*-

import unittest
from grid import *


class TestGrid(unittest.TestCase):
    def test_init(self):
        realSettings = RealSettings(yRealMax = 288, yRealMin = -72, xRealWidth = 400,
                                    xRealStep = 50, yRealStep = 50)
        grid = Grid(realSettings, RealKoeffs(0.5, 1.0))

        #print grid.xSampleWidth, grid.ySampleMin, grid.ySampleMax, grid.xSampleStep, grid.ySampleStep

        self.assertEqual(grid.xSampleWidth, 200)
        self.assertEqual(grid.ySampleMin, -72)
        self.assertEqual(grid.ySampleMax,288)
        self.assertEqual(grid.xSampleStep, 25)
        self.assertEqual(grid.ySampleStep, 50)

    def test_init_zero(self):
        realSettings = RealSettings(yRealMax = 0, yRealMin = 0, xRealWidth = 0,
                                    xRealStep = 0, yRealStep = 0)
        grid = Grid(realSettings, RealKoeffs(0, 0))

        #print grid.xSampleWidth, grid.ySampleMin, grid.ySampleMax, grid.xSampleStep, grid.ySampleStep

        self.assertEqual(grid.xSampleWidth, 0)
        self.assertEqual(grid.ySampleMin, 0)
        self.assertEqual(grid.ySampleMax, 0)
        self.assertEqual(grid.xSampleStep, 0)
        self.assertEqual(grid.ySampleStep, 0)

if __name__ == "__main__":

    load_case = unittest.defaultTestLoader.loadTestsFromTestCase
    suite = load_case(TestGrid)
    #suite.addTest(load_case(Test...))
    unittest.TextTestRunner(verbosity = 2).run(suite)

    #raw_input("press any key")
